#pragma once

#include "MBPlane.h"
#include "MBVec3.h"

/**
  *	An MBTriangleSightTriangle is defined by a single edge of the model
  * and the camera position.
  */
class MBTriangleSightTriangle
{
public:
	MBTriangleSightTriangle( const MBVec3 *edgePoints, const MBVec3 &cameraPosition );
	bool IsIntersectingWithAxisAlignedBox( const MBVec3 &boxMin, const MBVec3 &boxMax ) const;
	bool IsIntersectingWithTriangle( const MBVec3 *triangle_points ) const;
private:

	/**
	  * Enum value specifying the desired plane of the frustum. Order of the
	  * indices belongs to a CCW order when looked at from the inside of the
	  * frustum.
	  */
	enum MBPlaneIndex {
		P1_P0_CAMPOS = 0,
		P1_P0_CAMPOS_REVERSE = 1
	};

	/** The plane defined by the triangle sight triangle, and the same plane with reversed normal vector */
	MBPlane mPlanes[2];
	/** Point P0 of the edge */
	MBVec3 mP0;
	/** Point P1 of the edge */
	MBVec3 mP1;
	/** Position of the camera */
	MBVec3 mCamPos;
};